import type {PluginOption} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx';
import svgLoader from 'vite-svg-loader';
import configArcoStyleImportPlugin from './plugin/arcoStyleImport';
import createAutoImport from "./plugin/auto-import";
import createSvgIcon from "./plugin/svg-icon";
import createComponents from "./plugin/components";
import configCompressPlugin from "./plugin/compress";
export default function createVitePlugins(viteEnv: any, isBuild = false) {


    const vitePlugins: (PluginOption | PluginOption[])[] = [
        vue(),
        vueJsx(),
        svgLoader({svgoConfig: {}})
    ]
    vitePlugins.push(configArcoStyleImportPlugin())
    vitePlugins.push(createAutoImport())
    vitePlugins.push(createSvgIcon(isBuild))
    vitePlugins.push(createComponents())
    vitePlugins.push(configCompressPlugin('gzip'))
    return vitePlugins
}